import request from "@/utils/request";
import qs from 'qs'

export function categoryList(query) {
  return request({
    url:'/book/admin/category/list',
    method:'get',
    params:query
  })
}

export function addCategory(data){
  return request({
    url:'/book/admin/category/add',
    method:'put',
    data:data
  })
}

export function categoryById(id){
  return request({
    url:`/book/admin/category/bookCategoryById/${id}`,
    method:'get'
  })
}

export function updateCategory(data){
  return request({
    url:'/book/admin/category/update',
    method:'post',
    data:data
  })
}

export function deleteCategory(ids){
  const query={ids}
  return request({
    url:'/book/admin/category/delete',
    method:'delete',
    params:query,
    paramsSerializer:function (params){
      return qs.stringify(params,{arrayFormat:'repeat'})
    }
  })
}


